// Extends Log Class
var LGDSLog = Class.create(Log, {
  initialize: function ($super) {
    if(!DEBUG) return;
    $super();
    this.logWin = new Window({
      className: "log",
      title: "LGDS log",
      destroyOnClose: false,
      recenterAuto:false,
      left:0,
      top:0,
      width:350,
      height:150,
      zIndex: 100
    });
    // logWin.setCookie(logWin.getId(), 50,);
    // Add an observer on keypress
    Event.observe(document, 'keypress', this.show.bindAsEventListener(this));
    //Event.observe(window, 'load', this.show());
  },
  show: function (e) {
    if(!DEBUG) return;
    if(e.keyCode == 35) // 'end' key
    {
      this.logWin.setHTMLContent(this.get());
      this.logWin.show();
    }
  },
  put: function ($super, line) {
    if(!DEBUG) return;
    $super(line);
    // refresh the log window
    this.logWin.setHTMLContent(this.get());
  },
  clear: function ($super) {
    if(!DEBUG) return;
    $super();
    // refresh the log window
    this.logWin.setHTMLContent(this.get());
  }
});


// Test log
	
// 	function teste(e) {
//       if(e.keyCode == 99) log.clear();
//       else Event.stopObserving(document, 'keypress', teste);
// 	}
// 	
// 	
// 	Event.observe(document, 'keypress', function(e) {alert(e.keyCode);if(e.keyCode == 32) {log.add("Salut!"); }});
// 	
// 	Event.observe(document, 'keypress', function(e) {
// 	  if(e.keyCode == 18)
// 	  {
// 	    Event.observe(document, 'keypress', teste);
// 	  }
// 	});